package cn.iocoder.an.module.mold.dal.mysql.upkeepcategory;

import java.util.*;

import cn.iocoder.an.framework.common.pojo.PageResult;
import cn.iocoder.an.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.an.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.an.module.mold.dal.dataobject.upkeepcategory.UpkeepCategoryDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.an.module.mold.controller.admin.upkeepcategory.vo.*;

/**
 * 保养类型 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface UpkeepCategoryMapper extends BaseMapperX<UpkeepCategoryDO> {

    default PageResult<UpkeepCategoryDO> selectPage(UpkeepCategoryPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<UpkeepCategoryDO>()
                .eqIfPresent(UpkeepCategoryDO::getStatus, reqVO.getStatus())
                .likeIfPresent(UpkeepCategoryDO::getCode, reqVO.getCode())
                .likeIfPresent(UpkeepCategoryDO::getName, reqVO.getName())
                .eqIfPresent(UpkeepCategoryDO::getAccountMethod, reqVO.getAccountMethod())
                .eqIfPresent(UpkeepCategoryDO::getUpkeepPeriod, reqVO.getUpkeepPeriod())
                .eqIfPresent(UpkeepCategoryDO::getReminderPeriod, reqVO.getReminderPeriod())
                .betweenIfPresent(UpkeepCategoryDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(UpkeepCategoryDO::getId));
    }

}